{% load static %}

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>投票结果 | {{ question.question_text }}</title>
    <link rel="stylesheet" href="{% static 'polls/style.css' %}">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap" rel="stylesheet">
</head>
<body>
    <div class="poll-container result-container">
        <header class="poll-header">
            <h1><span class="icon">📊</span> 投票结果</h1>
            <p class="subtitle">{{ question.question_text }}</p>
        </header>

        <div class="result-content">
            <ul class="result-list">
                {% for choice in question.choice_set.all %}
                <li class="result-item">
                    <div class="choice-text">{{ choice.choice_text }}</div>
                    <div class="vote-progress">
                        <div class="progress-bar" style="width: {% widthratio choice.votes question.total_votes 100 %}%"></div>
                        <span class="vote-count">{{ choice.votes }} 票 ({% widthratio choice.votes question.total_votes 100 %}%)</span>
                    </div>
                </li>
                {% endfor %}
            </ul>

            <div class="total-votes">
                总投票数: <strong>{{ question.total_votes }}</strong> 票
            </div>

            <div class="action-buttons">
                <a href="{% url 'polls:detail' question.id %}" class="btn btn-revote">
                    <span class="icon">↻</span> 重新投票
                </a>
                <a href="{% url 'polls:index' %}" class="btn btn-back">
                    <span class="icon">←</span> 返回列表
                </a>
                <a href="http://119.23.145.136:8000/admin/" class="btn btn-admin">
                    <span class="icon">⚙️</span> 管理后台
                </a>
            </div>
        </div>
    </div>
</body>
</html>